#import "TabBarController.h"
#import "Settings.h"
#import "SettingsHolder.h"

@interface TabBarController ()
@property (nonatomic, strong) Settings* settings;
@end

@implementation TabBarController

-(Settings*)settings {
    if (!_settings) {
        _settings = [[Settings alloc] init];
    }
    return _settings;
}

-(void)viewDidLoad {
    [super viewDidLoad];
    for (UIViewController* viewController in self.viewControllers) {
        if ([viewController conformsToProtocol:@protocol(SettingsHolder)]) {
            id<SettingsHolder> settingHolder = (id<SettingsHolder>)viewController;
            [settingHolder setSettings:self.settings];
        }
    }
}

@end
